/*package x.amadeus.interceptor;

import java.io.IOException;
import java.security.ProviderException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jasig.cas.client.validation.Assertion;
import org.springframework.web.context.support.WebApplicationContextUtils;

import x.amadeus.staff.domain.SysUser;



public class AutoSetUserAdapterFilter implements Filter {
	public void destroy() {
		// TODO Auto-generated method stub

	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		HttpServletRequest httpRequest = (HttpServletRequest) request;
		HttpServletResponse httpResponse = (HttpServletResponse) response;
		// _const_cas_assertion_是CAS中存放登录用户名的session标志
		System.out.println("1");
		Object object = httpRequest.getSession().getAttribute("_const_cas_assertion_");
        if (object != null) {
            Assertion assertion = (Assertion) object;
            String loginName = assertion.getPrincipal().getName();
            SysUser user=(SysUser)httpRequest.getSession().getAttribute("user");
	        if (user == null) {
	        	try {
					//user=userProvider.getUserByExternalID(loginName);
				} catch (ProviderException e) {
					e.printStackTrace();
					httpResponse.sendRedirect("https://sso.ruijie.net:8443/fipm/account/ErrorPage.jsp?sys=trainee");
	        		return ;
				}
	        	if(user==null){
	        		httpResponse.sendRedirect("https://sso.ruijie.net:8443/fipm/account/ErrorPage.jsp?sys=trainee");
	        		return ;
	        	}
	        	httpRequest.getSession().setAttribute("user", user);
	        }
        }
        chain.doFilter(request, response);

	}
	public void init(FilterConfig arg0) throws ServletException {
		// TODO Auto-generated method stub
	}

}*/
